<?php
class FileUploadController {
	public function doFileUpload() {
		// Create instances that is needed
		$loginHandler = new LoginHandler();
		$fileUploadHandler = new FileUploadHandler();
		$fileUploadView = new FileUploadView();
		$content = "<div class='inner'>";
		// If user is logged in, add upload form to content-variable
		if ($loginHandler -> isLoggedIn()) {
			$fileUploadForm = $fileUploadView -> createFileUploadForm();
			$content .= $fileUploadForm;
		}
		// Uploading
		if($fileUploadView->triedToUpload()){
			if($fileUploadHandler->saveFile($fileUploadView->getUploadedFile())){
				//If fileupload succeded - show feedback
			}
			else{
				
			}
		}
		// Add list of files to content-variable
		$content .= $fileUploadView -> listFiles();
		return $content;
	}
}
?>